/*
	conditionLanguage/symbolTable.h
	@author:Wolfhead
*/
#ifndef WOLV_CONDITION_LANGUAGE_SYMBOL_TABLE_H
#define WOLV_CONDITION_LANGUAGE_SYMBOL_TABLE_H


#include <map>
#include <vector>
#include <string>
#include "variable.h"


namespace wolv
{
namespace condition
{

class SymbolImporter;
class LocalContext;

class SymbolTable
{
public:
	SymbolTable();
	~SymbolTable();

	VariableValue GetSymbol(const std::string& name);
	int LinkImporter(const std::string& name, SymbolImporter* pImporter);
	int ResetImporter();
	int SetContext(LocalContext* context);
	int ResetContext();

private:
	std::map<std::string, SymbolImporter*> table_;
	LocalContext* pContext_;
};


class SymbolImporter
{
public:
	SymbolImporter(const std::string& _namespace);
	virtual ~SymbolImporter();

	int Import(SymbolTable* symbolTabel);
	VariableValue Access(const std::string& name, LocalContext* context);

protected:
	virtual VariableValue _access(const std::string& name, LocalContext* context) = 0;
	std::string namepsace_;
};


class SystemImporter : public SymbolImporter
{
public:
	SystemImporter();

protected:
    VariableValue _access(const std::string& name, LocalContext* context);
};


}//namespace condition
}//namespace wolv




#endif
